/**
 * 
 * 申请单检验
 * 
 * */
import React from 'react';
import {
    Button, Table, Input, Row, Col, Icon, Card, Modal, Checkbox, Tabs, Select, Tooltip, Spin,
    message, Badge, Divider
} from 'antd';
import store from 'store';
import ShowChargeDetail from './ShowChargeDetail';
import { $http } from 'containers/config/https';
import ShowConfirmModal from './ShowConfirmModal';
import { Util } from 'tools/index';

const confirm = Modal.confirm;
const Option = Select.Option;

export default class InspectionRequest extends React.Component {
    constructor(props) {
        super(props);
        var userData = JSON.parse(sessionStorage.getItem('userData'));
        var patientData = JSON.parse(sessionStorage.getItem('patientData'))
        this.state = {
            tableData: [], // 已开申请项目单表格数据
            userData: userData,
            patientData: patientData,
            count: 0,
            saveStatus: false
        };
    }

    componentWillReceiveProps(nextProp) {
        if (nextProp.radioCode == 'L') {
            var newData = []
            var appItemID = ''
            if (nextProp.tableData && nextProp.tableData) {
                var data = nextProp.tableData
                for (var i = 0; i < data.length; i++) {
                    appItemID = data[0].appItemID
                    newData.push({
                        date: data[i].ordDate,
                        ordDesc: data[i].medDesc || data[i].ordDesc,
                        partList: data[i].bodyPartMessage,
                        ordSpecDesc: data[i].ordSpecDesc,
                        ordSpecID: data[i].ordSpecID,
                        ordPrice: data[i].price,
                        ordRecLocDesc: data[i].ordRecLocDesc,
                        ordRecLocID: data[i].ordRecLocID,
                        ordEMFlag: data[i].ordEMFlag,
                        appItemStatus: data[i].appItemStatus,
                        appItemID: data[i].appItemID,
                        ordQty: data[i].ordQty,
                        ordID: data[i].ordID,
                        medID: data[i].medID,
                        statusDesc: data[i].statusDesc,
                        appItemStatusCode: data[i].appItemStatusCode,
                    })
                }

            }
            this.setState({
                tableData: !Util.isEmpty(nextProp.radioList) ? newData : newData.concat(this.state.tableData),
                applicationMessage: nextProp.tableData ? nextProp.tableData.applicationMessage : '',
                appItemID: appItemID,
                dataSource: nextProp.dataSource,
                tabStatus: nextProp.tabStatus
            }, () => {
                this.initData()
            })
        }
    }

    componentDidMount() {
        this.props.onRef(this)
        this.loadLocalMsg()
        // this.initData()
    }

    loadLocalMsg() {
        let data = {
            params: [{
                compontName: "ApplicationForm",
                type: "C",
                reactCode: ['ApplicationForm']
            }]
        }
        $http.post('urlDeault', this, {
            code: "01040073",
            data: data,
            success: (res) => {
                if (+res.errorCode === 0) {
                    this.input.focus()
                    this.setState({
                        localeProvider: this.state.userData.language == 'EN' ? res.result.language.EN : res.result.language.CN
                    }, () => {
                        this.initData()
                    })
                }
            }
        })
    }

    //国际化
    setMessage(name, message) {
        return this.state.localeProvider && this.state.localeProvider[name] ? this.state.localeProvider[name][message] : ''
    }


    initData() {

        this.columns = [
            {
                title: this.setMessage('ApplicationFormStatus', 'descripts') || '状态',
                dataIndex: 'statusDesc',
                key: '7',
                width: '100px',
                align: 'center'
            }, {
                title: this.setMessage('ApplicationFormdates', 'descripts') || '开单日期',
                dataIndex: 'date',
                key: '1',
                width: '120px',
                align: 'center'
            }, {
                title: this.setMessage('ApplicationFormpro', 'descripts') || '项目名称',
                dataIndex: 'ordDesc',
                key: '2',
                width: '200px',
                align: 'left'
            }, {
                title: this.setMessage('ApplicationFormspecimen', 'descripts') || '标本',
                dataIndex: 'ordSpecDesc',
                key: '3',
                width: '100px',
                align: 'left',
                render: (text, data, index) => {
                    data.tableIndex = index + 1
                    var reclocListOption = []
                    data && data.specList && data.specList.map((item, index) => {
                        reclocListOption.push(<Option key={index} value={item.id}>{item.descripts}</Option>)
                    })
                    return !Util.isEmpty(data.ordID) ? <span>{data.ordSpecDesc}</span> : (<Select style={{ width: '100%' }}
                        value={data.ordSpecID}
                        onChange={this.changeCommonSelect.bind(this, 'ordSpecID', index)}>{reclocListOption}</Select>)
                }
            }, {
                title: '数量',
                dataIndex: 'ordQty',
                width: '80px',
                align: 'center',
                render: (text, data, index) => {
                    return !Util.isEmpty(data.ordID) ? <span>{data.ordQty}</span> :
                        <Input value={data.ordQty} onChange={this.handleChangeQty.bind(this, 'ordQty', index)} />
                }
            }, {
                title: this.setMessage('ApplicationFormPrice', 'descripts') || '价格',
                dataIndex: 'ordPrice',
                key: '4',
                width: '100px',
                align: 'right',
                render: (text, data, index) => {
                    return !Util.isEmpty(data.ordID) ? <span>{data.ordPrice}</span> : <span>{(data.ordQty || 1) * data.ordPrice}</span>
                }
            }, {
                title: this.setMessage('ApplicationFormexp', 'descripts') || '是否加急',
                dataIndex: 'ordEMFlag',
                key: '6',
                width: '80px',
                align: 'center',
                render: (text, data, index) => {
                    // return <span>{data.ordEMFlag == 'Y' ? '是' : '否'}</span>
                    return !Util.isEmpty(data.appItemID) ? <span>{data.ordEMFlag == 'Y' ? '是' : '否'}</span> :
                        <Checkbox checked={data.ordEMFlag == 'Y' ? true : (data.ordEMFlag == 'Y' ? true : false)}
                            onChange={this.changeCheckFlagBox.bind(this, 'ordEMFlag', index)} />
                }
            }, {
                title: this.setMessage('ApplicationFormdep', 'descripts') || '执行科室',
                dataIndex: 'ordRecLocID',
                key: '5',
                width: '100px',
                align: 'left',
                render: (text, data, index) => {
                    var reclocListOption = []
                    data && data.recLocList && data.recLocList.map((item, index) => {
                        reclocListOption.push(<Option key={index} value={item.recLocID}>{item.recLocDesc}</Option>)
                    })
                    return !Util.isEmpty(data.ordID) ? <span>{data.ordRecLocDesc}</span> : (<Select style={{ width: '100%' }}
                        value={data.ordRecLocID}
                        onChange={this.changeCommonSelect.bind(this, 'ordRecLocID', index)}>{reclocListOption}</Select>)
                }
            },
        ]
    }

    changeCheckFlagBox(name, index, e) {
        this.state.tableData[index][name] = e.target.checked ? 'Y' : 'N'
        this.setState({})
    }

    //展示收费项弹框
    showChargeDetail(data) {
        this.setState({
            isSHowChargeDetail: true,
            detailSource: data
        })
    }

    handleChangeQty(name, index, e) {
        this.state.tableData[index][name] = e.target.value
        this.setState({})
    }

    changeCommonSelect(name, index, e) {
        this.state.tableData[index][name] = e
        this.setState({})
    }
    //隐藏弹出框
    hideModal(name) {
        this.setState({
            [name]: false,//将所有参数置为false
        });
    }

    searchDataSource(e) {
        if (e.keyCode == '13') {
            var { searchDataSource } = this.props;
            searchDataSource && searchDataSource(this.state.search)
        }
    }

    //勾选复选框，弹框
    changeCheckBox = Util.debounce((medID, medDesc, index, e) => {
        var { tableData } = this.state;
        var data = []
        if (!Util.isEmpty(this.state.appItemID)) {
            message.error(this.setMessage('ApplicationFormexam', 'descripts'), this.state.userData && this.state.userData.messageTime)
            return
        }
        this.state.dataSource[index]['checked'] = e.target.checked
        if (e.target.checked) {
            if (!Util.isEmpty(tableData)) {
                for (var i = 0; i < tableData.length; i++) {
                    if (medID == tableData[i].medID) {
                        message.error(this.setMessage('ApplicationFormuna', 'descripts'), this.state.userData && this.state.userData.messageTime)
                        return
                    }
                }
            }
            this.setState({
                medID: medID,
                medDesc: medDesc,
                checked: e.target.checked,
                tableIndex: this.state.tableData.length,
                count: index == this.state.countIndex ? this.state.count : 0,
                search: undefined
            }, () => {
                this.input.focus()
                this.loadDoctorActive(medID, index)
            })
        } else {
            this.state.dataSource[index]['count'] = 0
            for (var i = 0; i < tableData.length; i++) {
                if (medID !== tableData[i].medID) {
                    data.push(tableData[i])
                }
            }
            this.setState({
                tableData: data,
                count: index == this.state.countIndex ? 0 : 0,
                search: undefined
            }, () => {
                this.input.focus()
            })
        }
    })

    onDoubleClickMsg = Util.debounce((medID, medDesc, index, e) => {
        var data = []
        var { tableData } = this.state;
        if (!Util.isEmpty(this.state.appItemID)) {
            message.error(this.setMessage('ApplicationFormexam', 'descripts'), this.state.userData && this.state.userData.messageTime)
            return
        }
        if (this.props.disBtn == 'alert') {
            message.error('当前病人已欠费，无法开具申请单！')
            return
        }
        if (this.state.dataSource[index]['checked'] == true) {
            this.state.dataSource[index]['checked'] = false
            this.state.dataSource[index]['count'] = 0
            for (var i = 0; i < tableData.length; i++) {
                if (medID !== tableData[i].medID) {
                    data.push(tableData[i])
                }
            }
            this.setState({
                tableData: data,
                count: index == this.state.countIndex ? 0 : 0,
                search: undefined
            }, () => {
                this.input.focus()
            })
        } else {
            this.state.dataSource[index]['checked'] = true
            if (!Util.isEmpty(tableData)) {
                for (var i = 0; i < tableData.length; i++) {
                    if (medID == tableData[i].medID) {
                        // message.error('无法添加重复数据')
                        message.error(this.setMessage('ApplicationFormbh', 'descripts'), this.state.userData && this.state.userData.messageTime)
                        return
                    }
                }
            }
            this.setState({
                medID: medID,
                medDesc: medDesc,
                tableIndex: this.state.tableData.length,
                count: index == this.state.countIndex ? this.state.count : 0,
                search: undefined
            }, () => {
                this.input.focus()
                this.loadDoctorActive(medID, index)
            })
        }
    })

    loadDoctorActive(id, index) {
        var that = this;
        var params = {
            params: [{
                admID: this.state.patientData ? this.state.patientData.admID : '',
                orders: [{
                    medID: this.state.medID,
                    ordSetID: ''
                }]
            }]
        }
        this.setState({ countIndex: index })
        $http.post('urlDeault', this, {
            code: "03050020",
            data: params,
            success: function (res) {
                if (res.errorCode == '0') {
                    if (res.errorData.length > 0) {
                        this.setState({
                            isShowConfirmModal: true,
                            errorData: res.errorData,
                            confirmData: res.confirmData,
                        })
                        return
                    }

                    if (res.confirmData.length > 0) {
                        confirm({
                            title: this.setMessage('ApplicationFormcomfirm', 'descripts'),
                            content: res.confirmData[0].errorMessage,
                            okText: that.state.userData.language == 'EN' ? 'Ok' : '确定',
                            cancelText: that.state.userData.language == 'EN' ? 'cancel' : '取消',
                            onOk() {
                                that.state.tableData.push({ tableIndex: that.state.tableData.length + 1 })
                                that.state.dataSource[index]['count'] = that.state.count + 1
                                that.hideModal('isShowPartsModal')
                                that.state.tableData[that.state.tableIndex]['ordDesc'] = res.data[0].defaultData.ordDesc,
                                    that.state.tableData[that.state.tableIndex]['ordDesc'] = res.data[0].defaultData.ordDesc,
                                    that.state.tableData[that.state.tableIndex]['appItemStatusCode'] = res.data[0].defaultData.appItemStatusCode,
                                    that.state.tableData[that.state.tableIndex]['ordDose'] = res.data[0].defaultData.ordDose,
                                    that.state.tableData[that.state.tableIndex]['ordDate'] = res.data[0].defaultData.date,
                                    that.state.tableData[that.state.tableIndex]['ordTime'] = res.data[0].defaultData.time,
                                    that.state.tableData[that.state.tableIndex]['date'] = res.data[0].defaultData.date,
                                    that.state.tableData[that.state.tableIndex]['time'] = res.data[0].defaultData.time,
                                    that.state.tableData[that.state.tableIndex]['ordStartDate'] = res.data[0].defaultData.date,
                                    that.state.tableData[that.state.tableIndex]['ordbodyPart'] = [],
                                    that.state.tableData[that.state.tableIndex]['ordStartTime'] = res.data[0].defaultData.time,
                                    that.state.tableData[that.state.tableIndex]['ordPrice'] = res.data[0].defaultData.ordPrice,
                                    that.state.tableData[that.state.tableIndex]['ordSpecID'] = res.data[0].defaultData.ordSpecID,
                                    that.state.tableData[that.state.tableIndex]['ordEMFlag'] = res.data[0].defaultData.ordEMFlag,
                                    that.state.tableData[that.state.tableIndex]['ordPriorityID'] = res.data[0].defaultData.ordPriorityID,
                                    that.state.tableData[that.state.tableIndex]['ordAdmReasonID'] = res.data[0].defaultData.ordAdmReasonID,
                                    that.state.tableData[that.state.tableIndex]['ordRecLocID'] = res.data[0].defaultData.ordRecLocID,
                                    that.state.tableData[that.state.tableIndex]['ordQtyUomID'] = res.data[0].defaultData.ordQtyUomID,
                                    that.state.tableData[that.state.tableIndex]['recLocList'] = res.data[0].dataList.recLocList,//接收科室
                                    that.state.tableData[that.state.tableIndex]['specList'] = res.data[0].dataList.specList,//标本
                                    that.state.tableData[that.state.tableIndex]['count'] = that.state.count,//标本
                                    that.state.tableData[that.state.tableIndex]['ordSeqNo'] = 1,
                                    that.state.tableData[that.state.tableIndex]['ordQty'] = res.data[0].defaultData.ordQty,
                                    that.state.tableData[that.state.tableIndex]['medID'] = that.state.medID,
                                    that.setState({
                                        // tableData: tableData,
                                        recLocList: res.data[0].dataList.recLocList,//接收科室,
                                        count: that.state.count + 1,
                                        search: undefined
                                    }, () => {
                                        that.input.focus()
                                    })
                            },
                            onCancel() {
                                that.setState({
                                    search: undefined
                                }, () => {
                                    that.input.focus()
                                })
                            },
                        });
                    } else {
                        that.state.tableData.push({ tableIndex: that.state.tableData.length + 1 })
                        this.state.dataSource[index]['count'] = this.state.count + 1
                        this.hideModal('isShowPartsModal')
                        this.state.tableData[this.state.tableIndex]['ordDesc'] = res.data[0].defaultData.ordDesc,
                            this.state.tableData[this.state.tableIndex]['ordDose'] = res.data[0].defaultData.ordDose,
                            this.state.tableData[this.state.tableIndex]['appItemStatusCode'] = res.data[0].defaultData.appItemStatusCode,
                            this.state.tableData[this.state.tableIndex]['ordDate'] = res.data[0].defaultData.date,
                            this.state.tableData[this.state.tableIndex]['ordTime'] = res.data[0].defaultData.time,
                            this.state.tableData[this.state.tableIndex]['date'] = res.data[0].defaultData.date,
                            this.state.tableData[this.state.tableIndex]['time'] = res.data[0].defaultData.time,
                            that.state.tableData[that.state.tableIndex]['ordStartDate'] = res.data[0].defaultData.date,
                            that.state.tableData[that.state.tableIndex]['ordStartTime'] = res.data[0].defaultData.time,
                            this.state.tableData[this.state.tableIndex]['ordPrice'] = res.data[0].defaultData.ordPrice,
                            this.state.tableData[this.state.tableIndex]['ordSpecID'] = res.data[0].defaultData.ordSpecID,
                            this.state.tableData[this.state.tableIndex]['ordbodyPart'] = [],
                            this.state.tableData[this.state.tableIndex]['ordEMFlag'] = res.data[0].defaultData.ordEMFlag,
                            this.state.tableData[this.state.tableIndex]['ordPriorityID'] = res.data[0].defaultData.ordPriorityID,
                            this.state.tableData[this.state.tableIndex]['ordAdmReasonID'] = res.data[0].defaultData.ordAdmReasonID,
                            this.state.tableData[this.state.tableIndex]['ordRecLocID'] = res.data[0].defaultData.ordRecLocID,
                            this.state.tableData[this.state.tableIndex]['ordQtyUomID'] = res.data[0].defaultData.ordQtyUomID,
                            this.state.tableData[this.state.tableIndex]['recLocList'] = res.data[0].dataList.recLocList,//接收科室
                            this.state.tableData[this.state.tableIndex]['specList'] = res.data[0].dataList.specList,//接收科室
                            that.state.tableData[that.state.tableIndex]['count'] = that.state.count,//标本
                            this.state.tableData[this.state.tableIndex]['ordSeqNo'] = 1,
                            that.state.tableData[that.state.tableIndex]['ordQty'] = res.data[0].defaultData.ordQty,
                            this.state.tableData[this.state.tableIndex]['medID'] = this.state.medID,
                            this.setState({
                                // tableData: tableData,
                                recLocList: res.data[0].dataList.recLocList,//接收科室,
                                count: this.state.count + 1,
                                search: undefined
                            }, () => {
                                that.input.focus()
                            })
                    }
                }
            }
        });
    }

    confirmAdviceModal() {
        this.hideModal('isShowConfirmModal')
    }
    clearInput() {
        this.setState({
            tableData: [],
            tabStatus: false,
            appItemID: undefined
        })
        var { clearInput } = this.props;
        clearInput && clearInput()
    }
    handleSaveCheckData() {
        var { tableData, dataSource, ids } = this.state;
        this.setState({ saveStatus: true })
        if (Util.isEmpty(tableData)) {
            message.error(this.setMessage('ApplicationFormsaved', 'descripts'), this.state.userData && this.state.userData.messageTime)
            this.setState({ saveStatus: false })
            return
        }
        for (var i = 0; i < tableData.length; i++) {
            if (Util.isEmpty(tableData[i].ordRecLocID)) {
                message.error(this.setMessage('ApplicationFormexec', 'descripts'), this.state.userData && this.state.userData.messageTime)
                this.setState({ saveStatus: false })
                return
            }
        }
        var sourceMap = []
        if (!Util.isEmpty(ids)) {
            for (var i = 0; i < ids.length; i++) {
                for (var j = 0; j < tableData.length; j++) {
                    if (!Util.isEmpty(ids) && ids[i] == tableData[j].tableIndex) {
                        sourceMap.push(tableData[j])
                    }
                }
            }
        } else {
            for (var i = 0; i < tableData.length; i++) {
                if (Util.isEmpty(tableData[i].ordID)) {
                    sourceMap.push(tableData[i])
                }
            }
        }

        var params = {
            params: [
                {
                    admID: this.state.patientData ? this.state.patientData.admID : '',
                    locID: this.state.userData.locID,
                    docID: this.state.userData.userID,
                    userID: this.state.userData.userID,
                    hospID: this.state.userData.hospID,
                    medType: 'WM',
                    orders: sourceMap,
                    ordSpecID: this.state.ordSpecID
                }
            ]
        }
        $http.post('urlDeault', this, {
            code: "03050001",
            data: params,
            success: function (res) {
                if (res.errorCode == '0') {
                    message.success(this.setMessage('ApplicationFormdf', 'descripts'), this.state.userData && this.state.userData.messageTime)
                    for (var i = 0; i < dataSource.length; i++) {
                        this.state.dataSource[i]['count'] = 0
                        this.state.dataSource[i]['checked'] = false
                    }
                    this.setState({
                        tableData: [],
                        saveStatus: false,
                        search: undefined
                    }, () => {
                        this.input.focus()
                        var { loadDelData } = this.props;
                        loadDelData && loadDelData('check')
                    })
                } else {
                    this.setState({
                        saveStatus: false
                    })
                }
            }
        });
    }

    onSelectChange(ids, selectData) {
        this.setState({
            ids: ids,
            selectData: selectData
        })
    }

    delTableDataOfBack() {
        var { ids, tableData } = this.state;
        this.setState({ saveStatus: true })
        if (Util.isEmpty(ids)) {
            message.error(this.setMessage('ApplicationFormbas', 'descripts'), this.state.userData && this.state.userData.messageTime)
            this.setState({ saveStatus: false })
            return
        }
        for (var i = 0; i < ids.length; i++) {
            if (typeof (ids[i]) !== 'string') {
                message.error(this.setMessage('ApplicationFormqwe', 'descripts'), this.state.userData && this.state.userData.messageTime)
                this.setState({ saveStatus: false })
                return
            }
        }
        for (var i = 0; i < ids.length; i++) {
            for (var j = 0; j < tableData.length; j++) {
                if (ids[i] == tableData[j].appItemID && tableData[j].appItemStatusCode == 'CO') {
                    message.error(this.setMessage('ApplicationFormef', 'descripts'), this.state.userData && this.state.userData.messageTime)
                    this.setState({ saveStatus: false })
                    return
                }
            }

        }
        var params = {
            params: [{
                ordID: this.state.ids
            }]
        }
        $http.post('urlDeault', this, {
            code: "03050038",
            data: params,
            success: function (res) {
                if (res.errorCode == '0') {
                    message.success(this.setMessage('ApplicationFormundo', 'descripts'), this.state.userData && this.state.userData.messageTime)
                    this.setState({
                        tableData: [],
                        ids: [],
                        saveStatus: false
                    }, () => {
                        var { loadDelData } = this.props;
                        loadDelData && loadDelData()
                    })
                } else {
                    this.setState({
                        saveStatus: false
                    })
                }
            }
        });
    }

    delMechansim() {
        var { ids, tableData, selectData, dataSource } = this.state;
        if (Util.isEmpty(ids)) {
            message.error(this.setMessage('ApplicationFormdete', 'descripts'), this.state.userData && this.state.userData.messageTime)
            return
        }
        for (var i = 0; i < ids.length; i++) {
            for (var j = 0; j < tableData.length; j++) {
                if (typeof (ids[i]) == 'string') {
                    // message.error(this.setMessage('ApplicationFormas', 'descripts'),this.state.userData && this.state.userData.messageTime)
                    // return
                    this.delTableDataOfBack()
                } else {
                    if (ids[i] == tableData[j].tableIndex) {
                        this.state.tableData.splice(j, 1);
                    }
                }
            }
        }
        for (var i = 0; i < selectData.length; i++) {
            for (var k = 0; k < dataSource.length; k++) {
                if (selectData[i].medID == dataSource[k].medID) {
                    this.state.count = 0
                    this.state.dataSource[k]['count'] = 0
                    this.state.dataSource[k]['checked'] = false
                }
            }
        }
        this.setState({ ids: [] })
    }

    render() {
        let { tableData, ids } = this.state;
        var { dataSource } = this.props;
        const rowSelection = {
            ids,
            onChange: this.onSelectChange.bind(this),
            selectedRowKeys: ids,
            getCheckboxProps: record => ({
                disabled: this.props.disBtn == 'alert', // Column configuration not to be checked
            }),
        }

        var sourceOption = []
        dataSource && dataSource.map((item, index) => {
            sourceOption.push(<Badge count={item.count} style={{ marginTop: 10, backgroundColor: '#fa541c' }}>
                <span className="check-child-spans" key={index}
                    style={{ display: 'block', width: '34vh', marginLeft: 20 }}>
                    <div style={{ display: 'flex' }}>
                        <Checkbox onChange={(e) => this.changeCheckBox(item.medID, item.medDesc, index, e)}
                            disabled={this.state.tabStatus || (this.props.disBtn == 'alert')}
                            checked={item.checked} />
                        <div style={{ paddingLeft: '5px', cursor: 'pointer' }} className='doctor-check-text-ellipisis'
                            onClick={(e) => this.onDoubleClickMsg(item.medID, item.medDesc, index, e)}>
                            <Tooltip title={item.medDesc}>{item.medDesc}</Tooltip>
                        </div>
                        <div style={{ cursor: 'pointer', color: '#40a9ff' }}
                            onClick={this.showChargeDetail.bind(this, item)}>
                            <Divider type="vertical" />{item.medPrice}</div></div>
                </span></Badge>)
        })
        return (
            <Spin spinning={this.state.saveStatus} tip='加载中...'><div>
                {/**展示收费项明细弹框 */}
                <ShowChargeDetail isShow={this.state.isSHowChargeDetail}
                    detailSource={this.state.detailSource}
                    onHide={this.hideModal.bind(this, 'isSHowChargeDetail')}>
                </ShowChargeDetail>
                {/**确认医嘱弹框 */}
                <ShowConfirmModal isShow={this.state.isShowConfirmModal}
                    confirmData={this.state.confirmData}
                    errorData={this.state.errorData}
                    onSubmit={this.confirmAdviceModal.bind(this)}
                    onHide={this.hideModal.bind(this, 'isShowConfirmModal')}>
                </ShowConfirmModal>
                <div>
                    <div className="modal-header">
                        <span className='scheduling-title-border' style={{ margin: '10px' }}></span>
                        {this.props.breadcrumb}
                        <div style={{ float: 'right', height: 34 }}>
                            项目查询：<Input placeholder={this.setMessage('ApplicationFormquery', 'descripts')} style={{ width: '300px' }}
                                onChange={Util.commonInputChange.bind(this, 'search')} value={this.state.search} ref={(input) => this.input = input}
                                onKeyDown={this.searchDataSource.bind(this)} />
                        </div>
                    </div>
                    <div style={{ height: store.getState().tableHeight.y - 254 + 'px', overflow: 'auto' }}>
                        <Row style={{ height: '100%' }}>
                            <Col span={24} style={{ height: '100%', overflow: 'auto' }} className='source-btn'>
                                {sourceOption}
                            </Col>
                        </Row>
                    </div>
                </div>
                <div>
                    <div className="modal-header">
                        <span className='scheduling-title-border' style={{ margin: '10px' }}></span>
                        {this.setMessage('ApplicationFormzz', 'descripts')}
                    </div>
                    <div style={{ height: '32px', lineHeight: '32px', padding: '0 12px' }}>
                        {/* <span className={tableData && tableData.length > 0 ? "span" : 'dis-span'}
                            onClick={this.delTableDataOfBack.bind(this)}>
                            <Icon className='application-reload'/>
                            {this.setMessage('ApplicationFormRevoke', 'descripts')}
                        </span><Divider type="vertical" /> */}
                        <span className={tableData && tableData.length > 0 ? "span" : 'dis-span'}
                            onClick={this.delMechansim.bind(this)}>
                            <Icon className='doctor-delete-splice' />
                            {this.setMessage('ApplicationFormDelete', 'descripts')}
                        </span>
                        <span style={{ float: 'right' }}>
                            <Button type='primary' size='small' disabled={this.props.disBtn == 'alert'}
                                onClick={this.handleSaveCheckData.bind(this)}>{this.setMessage('ApplicationFormReview', 'descripts')}</Button><Divider type="vertical" />
                            <Button size='small' disabled={this.props.disBtn == 'alert'} onClick={this.clearInput.bind(this)}>{this.setMessage('ApplicationFormClear', 'descripts')}</Button>
                        </span>
                    </div>
                    <div>
                        <Table
                            columns={this.columns}
                            dataSource={tableData}
                            scroll={{ y: 170 }}
                            rowSelection={rowSelection}
                            rowKey={(data) => {
                                return data.ordID || data.tableIndex
                            }}
                            bordered pagination={false}
                        />
                    </div>
                </div>
            </div></Spin>
        )
    }
}